<?php

require_once ('db_config.php');

session_start();

$name = $_POST['username'];
$password = $_POST['password'];

if (isset($name) && isset($password)) {
    $query = mysql_query("select * from users where name = '$name' and password = '$password';");

    if (mysql_num_rows($query) == 1) {
        $_SESSION['username'] = $name;
        header('Location: http://localhost/miras/test/test.html');
    } else {
        $_SESSION['error'] = "Не правильный пароль";
        echo "Error";
        
    }
} else {
    echo "Error";
}
?>
